package com.haipi.service.impl;

import java.util.Timer;

import javax.annotation.Resource;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import com.haipi.service.IInitService;
import com.haipi.service.IMailService;
import com.haipi.time.CommTask;
import com.haipi.time.CommTimer;

@Component("initService")
@Scope("singleton")
public class InitServiceImpl implements IInitService
{
	@Resource
	IMailService mailService;

	@Override
	public void initMailTimer()
	{
		Timer timer = new CommTimer();
		CommTask task = new CommTask(mailService);

		long period = 60 * 1000;

		timer.schedule(task, 0l, period);
	}

}
